<template>
	<!-- 谱文详情 -->
	<view class="wen_all">
		<view class="wen_info_part" :style="{backgroundImage:'url('+photo_cdn+'zpupload/20230902/58c1b035ae0d81b9a9.png)'}"></view>
		<view class="wen_info" :style="{backgroundImage:'url('+photo_cdn+'zpupload/20230902/145c4d4ef04501ca0d.png)'}">
			<view class="wen_title">{{wen_title}}</view>
			<jyf-parser :html="wen_info.content" :domain="false" ref="article" selectable show-with-animation use-anchor
				@error="error" @imgtap="imgtap" @linkpress="linkpress" @parse="parse" @ready="ready">加载中...
			</jyf-parser>
		</view>
		<view class="wen_info_part" :style="{backgroundImage:'url('+photo_cdn+'zpupload/20230902/1cbbe581e4ae362a6c.png)'}"></view>
	</view>
</template>

<script>
	import parser from '@/components/jyf-parser/jyf-parser';
	import config from "@/utils/config.js";
	let {photo_cdn} = config.baseUrl;
	import {puwen_detail} from '@/utils/api/zupu.js';
	export default{
		components:{
			'jyf-parser': parser,
		},
		data(){
			return{
				photo_cdn,
				wen_info:{},
				article_id:0,
				scrollHeight: 0,
				wen_title:''
			}
		},
		onLoad(option){
			this.article_id= option.article_id?option.article_id:0;
			this.puwen_detailfun();
		},
		onReady() {
			this.computeheight()
		},
		methods:{
			//获取详情
			async puwen_detailfun(){
				let res = await puwen_detail({
					article_id:this.article_id
				})
				if(res.code==1){
					this.wen_info = res.data.info;
					this.wen_title = res.data.info.title;
				}
			},
			//出错时触发
			error(res) {
			
			},
			//图片被点击时触发
			imgtap(res) {
				console.info(res,"图片点击");
			},
			//链接被点击时触发
			linkpress(res) {
				// #ifdef APP-PLUS
				if (res.href && res.href.includes('http')) {
					res.ignore();
				}
				// #endif
			},
			//解析完成时触发
			parse(res) {
			},
			//渲染完成时触发	
			ready(res) {
			},
			computeheight(){
				let resinfo = uni.getSystemInfoSync();
				let windowHeight = resinfo.windowHeight;
				this.scrollHeight = windowHeight;
			}
		}
	}
</script>

<style lang="scss">
	@import "./wen_info.scss"
</style>